extends Control
class_name 基础弹窗类

var 弹窗id:String
var 识别码:int=-1
	
signal close_requested

func 初始化(_data):
	显示()
	
func 退出():
	close_requested.emit()

func 关闭():
	GameViewManager.关闭弹窗(识别码)
	close_requested.emit()

func 显示():
	var tw=create_tween().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_LINEAR)
	tw.parallel().tween_property(self, "scale", Vector2(1, 1), 0.2).from(Vector2(0, 0))
	tw.parallel().tween_property(self, "position", position, 0.2).from(position+size/2)
	show()

func _gui_input(event):
	if event.is_action_pressed("mouse_right"):
		关闭()
